#include <windows.h>
#include "CCharStatsPacket.h"

CCharStatsPacket::CCharStatsPacket(CChar * schar) {

	memset(this->data, 0, 0x2a*2);

	this->type = 0x61;	//CharStats
	this->size = 0x2a;	// size
	
	int hp = schar->getMaxHp();
	int mp = schar->getMaxMp();

	unsigned short def = schar->getDef();
	unsigned short atk = schar->getAttack();

	memcpy(this->data+0x30-4, (char*)&atk, 2);
	memcpy(this->data+0x32-4, (char*)&def, 2);
	memcpy(this->data+0x0c-4, &schar->m_jobMain,	1);
	memcpy(this->data+0x0d-4, &schar->m_lvlMain,	1);
	memcpy(this->data+0x0e-4, &schar->m_jobSub,		1);
	memcpy(this->data+0x0f-4, &schar->m_lvlSub,		1);

	memcpy(this->data+0x10-4, &schar->m_expCurrent,			2);
	memcpy(this->data+0x12-4, &schar->m_expForNextLevel,	2);

	memcpy(this->data+0x14-4, &schar->stats,		28);

	memcpy(this->data+0x04-4, (char*)&hp,			4);
	memcpy(this->data+0x08-4, (char*)&mp,			4);

	memcpy(this->data+0x34-4, &schar->r, 16);

	memcpy(this->data+0x44-4, &schar->m_currentTitle, 2);

	this->data[0x46-4] = schar->st.n.rank[schar->st.n.home];
	*(unsigned short*)(this->data+0x48-4) = schar->st.n.rankpoints[schar->st.n.home];
	this->data[0x50-4] = schar->st.n.home;	
	memcpy(data+0x4a-4,&schar->st.homepoint,1);


}

CCharStatsPacket::~CCharStatsPacket() {

}